<?php
/*
 * @Author: Terry
 * @Date: 2024-01-31 13:16:45
 * @LastEditors: Terry
 * @LastEditTime: 2024-12-16 23:53:42
 * @Description: 电子证书路由
 * @FilePath: \auxface_certificate\app\certificate\route\route.php
 */

use think\facade\Route;

Route::group('admin/v1/', function () {
        //设备许可证
        Route::group('machineRisk/', function () {
    
            Route::group('index/', function () {
                Route::group('', function () {
                    Route::get('pdf', 'index/pdf'); //pdf导出详情
                });
            });
        })->prefix('admin.v1.machineRisk.');
})->prefix('admin.v1.');


//管理端路由api
Route::group('admin/v1/', function () {

    //数字化追踪设备管理
    Route::group('digitalMachine/', function () {
        //设备类型
        Route::group('type/', function () {
            Route::group('', function () {

                Route::get('getList', 'type/getList'); //列表
                Route::post('create', 'type/create'); //创建
                Route::put('update', 'type/update'); //修改
                Route::delete('destroy', 'type/destroy'); //删除
                Route::get('detail', 'type/getDetail'); //详情
            })->middleware('checkAuth');

            Route::get('getOptions', 'type/getThreeOptions'); //三个下拉选择
        });

        //设备
        Route::group('machine/', function () {
            Route::group('', function () {

                Route::get('getList', 'machine/getList'); //列表
                Route::post('create', 'machine/create'); //创建
                Route::put('update', 'machine/update'); //修改
                Route::delete('destroy', 'machine/destroy'); //删除
                Route::get('detail', 'machine/getDetail'); //详情
                Route::post('entryMachines', 'machine/editMachineEntry'); //设备进场
                Route::post('exitMachines', 'machine/editMachineExit'); //设备离场
                Route::post('bindDrivers', 'machine/editDrivers'); //设备绑定驾驶员
                Route::post('bindAreas', 'machine/editAreas'); //设备绑定区域
                Route::get('getHeavyList', 'machine/getDigitalMachineBindHeavyMachineCheckList'); //设备查询检查表
                Route::get('getRepairList', 'machine/getDigitalMachineBindDigitalMachineRepairList'); //设备查询检修表
                Route::get('getRepairData', 'machine/getDigitalMachineRepairRecordData'); //检修uuid查询检修记录详情
                Route::post('driverGetMachines', 'machine/accordWorkerUuidGetDigitalMachine'); //驾驶员获取绑定设备
                Route::get('getFileList', 'machine/getDigitalMachineFileList'); //设备获取文件列表
                Route::get('getFileData', 'machine/getFileData'); //获取附件详情
            })->middleware('checkAuth');

            Route::get('getOptions', 'machine/getOptions'); //获取字典
        });

    })->prefix('admin.v1.digitalMachine.');

    //分配区域
    Route::group('area/', function () {
        Route::get('getList', 'area/getList'); //列表
        Route::post('create', 'area/create'); //创建
        Route::put('update', 'area/update'); //更新
        Route::delete('destroy', 'area/destroy'); //刪除
        Route::get('getDetail', 'area/getDetail'); //详情
        Route::get('getWorkerList', 'area/getWorkerList'); //区域人员列表
        Route::put('changeWorker', 'area/changeWorker'); //修改区域人员
        Route::get('getTypeList', 'area/getTypeList'); //所属类型列表
        Route::put('changeType', 'area/changeType'); //修改所属类型
    });

    //高危許可證
    Route::group('risk/', function () {

        Route::group('type/', function () {
            Route::group('', function () {

                Route::get('getList', 'type/getList'); //列表
                Route::post('create', 'type/create'); //创建
                Route::put('update', 'type/update'); //更新
                Route::put('exit', 'type/exit'); //退场
                Route::delete('destroy', 'type/destroy'); //刪除
                Route::get('getDetail', 'type/getDetail'); //详情

                Route::get('getWorkerAuthList', 'type/getWorkerAuthList'); //获取许可证类型人员权限列表
                Route::put('changeWorkerAuth', 'type/changeWorkerAuth'); //修改许可证类型人员权限
            })->middleware('checkAuth');

            Route::get('getOptions', 'type/getOptions'); //获取字典
        });

        Route::group('index/', function () {
            Route::group('', function () {

                Route::get('getList', 'index/getList'); //列表
                Route::get('getDetail', 'index/getDetail'); //列表
                Route::delete('destroy', 'index/destroy'); //移除人员
                Route::get('getWorker', 'index/getWorker'); //获取相关人员数据
                Route::put('changeWorker', 'index/changeWorker'); //修改相关人员数据
                Route::post('html2Pdf', 'index/html2Pdf'); //导出pdf
                Route::get('pdf', 'index/pdf'); //pdf导出详情
            })->middleware('checkAuth');

            Route::get('getOptions', 'index/getOptions'); //获取字典
        });
    })->prefix('admin.v1.risk.');

    //高危許可證
    Route::group('risk/', function () {
        Route::group('index/', function () {
            Route::get('pdfpage', 'index/pdfpage'); //导出pdf
        });
    });

    //重型許可證
    Route::group('checklist/', function () {

        Route::group('type/', function () {
            Route::group('', function () {
                Route::get('getList', 'type/getList'); //列表
                Route::post('create', 'type/create'); //创建
                Route::put('update', 'type/update'); //更新
                Route::put('exit', 'type/exit'); //退场
                Route::delete('destroy', 'type/destroy'); //刪除
                Route::get('getDetail', 'type/getDetail'); //详情
                Route::put('changeWorkerAuth', 'type/changeWorkerAuth'); //修改许可证类型人员权限
                Route::get('getWorkerAuthList', 'type/getWorkerAuthList'); //获取许可证类型人员权限列表
            })->middleware('checkAuth');

            Route::get('getOptions', 'type/getOptions'); //获取字典
        });

        Route::group('index/', function () {
            Route::group('', function () {

                Route::get('getList', 'index/getList'); //列表
                Route::get('getDetail', 'index/getDetail'); //列表
                Route::delete('destroy', 'index/destroy'); //移除人员
                Route::get('getWorker', 'index/getWorker'); //获取相关人员数据
                Route::put('changeWorker', 'index/changeWorker'); //修改相关人员数据
                Route::post('html2Pdf', 'index/html2Pdf'); //导出pdf
                Route::get('pdf', 'index/pdf'); //pdf导出详情
            })->middleware('checkAuth');

            Route::get('getOptions', 'index/getOptions'); //获取字典
        });

    })->prefix('admin.v1.checklist.');

    //培训签到
    Route::group('train/', function () {
        Route::group('', function () {

            Route::get('getList', 'train/getList'); //列表
            Route::get('trainLog', 'train/trainLog'); //列表
            Route::post('create', 'train/create'); //创建
            Route::put('update', 'train/update'); //修改
            Route::delete('destroy', 'train/destroy'); //删除
        })->middleware('checkAuth');

        Route::get('getOptions', 'train/getOptions'); //获取字典
    });

    Route::group('file/', function () {

        Route::group('index', function () {
            Route::get('getList', 'index/getList'); //列表
            Route::post('create', 'index/create'); //创建
            Route::put('update', 'index/update'); //更新
            Route::delete('destroy', 'index/destroy'); //刪除
            Route::get('getDetail', 'index/getDetail'); //详情
        })->middleware('checkAuth');

        Route::group('type', function () {

            Route::group('', function () {
                Route::get('getList', 'type/getList'); //列表
                Route::post('create', 'type/create'); //创建
                Route::put('update', 'type/update'); //更新
                Route::delete('destroy', 'type/destroy'); //刪除
                Route::get('getDetail', 'type/getDetail'); //详情
                Route::get('getFileList', 'type/getFileList'); //附件列表
                Route::put('changeFile', 'type/changeFile'); //修改附件
            })->middleware('checkAuth');

            Route::get('getOptions', 'type/getOptions'); //获取字典
        });

    })->prefix('admin.v1.file.');

    Route::group('flow/', function () {

        Route::group('index', function () {
            Route::get('getList', 'index/getList'); //列表
            Route::post('create', 'index/create'); //创建
            Route::put('update', 'index/update'); //更新
            Route::delete('destroy', 'index/destroy'); //刪除
            Route::get('getDetail', 'index/getDetail'); //详情
        })->middleware('checkAuth');

        Route::group('form', function () {
            Route::group('', function () {
                Route::get('getList', 'form/getList'); //列表
                Route::post('create', 'form/create'); //创建
                Route::put('update', 'form/update'); //更新
                Route::delete('destroy', 'form/destroy'); //刪除
                Route::get('getDetail', 'form/getDetail'); //详情
                Route::get('getWorker', 'form/getWorker'); //获取人员权限
                Route::put('changeWorker', 'form/changeWorker'); //更新人员权限
                Route::put('changeFormData', 'form/changeFormData'); //更新表单配置
                Route::get('getFormData', 'form/getFormData'); //获取表单数据
            })->middleware('checkAuth');

            Route::get('getAllList', 'form/getAllList'); //全部列表
            Route::get('getOptions', 'form/getOptions'); //获取字典
        });

    })->prefix('admin.v1.flow.');

    //设备许可证
    Route::group('machineRisk/', function () {

        Route::group('SubForm/', function () {
            Route::group('', function () {
                Route::get('getList', 'SubForm/getList'); //列表
                Route::post('create', 'SubForm/create'); //创建
                Route::put('update', 'SubForm/update'); //更新
                Route::delete('destroy', 'SubForm/destroy'); //刪除
                Route::get('getDetail', 'SubForm/getDetail'); //详情 
            })->middleware('checkAuth');
        });

        Route::group('type/', function () {
            Route::group('', function () {
                Route::get('getList', 'type/getList'); //列表
                Route::post('create', 'type/create'); //创建
                Route::put('update', 'type/update'); //更新
                Route::delete('destroy', 'type/destroy'); //刪除
                Route::get('getDetail', 'type/getDetail'); //详情
                Route::put('changeFileType', 'type/changeFileType'); //更新附件类型
                Route::put('changeSubForm', 'type/changeSubForm'); //更新附表
            })->middleware('checkAuth');

            Route::get('getOptions', 'type/getOptions'); //获取字典
        });

        Route::group('index/', function () {
            Route::group('', function () {
                Route::get('getList', 'index/getList'); //列表
                Route::get('getDetail', 'index/getDetail'); //详情
                Route::get('getSubList', 'index/getSubList'); //附表列表
                Route::get('getSubDetail', 'index/getSubDetail'); //附表详情
                Route::post('html2Pdf', 'index/html2Pdf'); //导出pdf
                Route::get('pdf', 'index/pdf'); //pdf导出详情

                Route::post('subHtml2Pdf', 'index/html2Pdf'); //导出pdf
                Route::get('subPdf', 'index/pdf'); //pdf导出详情
            })->middleware('checkAuth');

            Route::get('pdf', 'index/pdf'); //pdf导出详情
        });
    })->prefix('admin.v1.machineRisk.');

    //万能表单
    Route::group('form/', function () {
        Route::group('', function () {
            Route::get('getData', 'form/getData'); //列表
            Route::post('create', 'form/create'); //创建
            Route::put('update', 'form/update'); //修改
        });

        Route::get('element', 'form/element'); //列表
    });

})->prefix('admin.v1.')->middleware(['checkLogin', 'getAuthWhere', 'checkData', 'dataEncryption']);



//用户端路由api
Route::group('user/v1/', function () {

    //设备电子证书
    Route::group('machine/', function () {
        Route::get('getList', 'machine/getList'); //列表
        Route::get('getData', 'machine/getData'); //获取设备详情
        Route::get('getTemplateList', 'machine/getTemplateList'); //获取模板列表
        Route::post('apply', 'machine/apply'); //设备申请
    });

    //设备电子证书流程
    Route::group('machineFlow/', function () {
        Route::get('getList', 'machineFlow/getList');
        Route::post('create', 'machineFlow/create');
        Route::put('update', 'machineFlow/update');
        Route::delete('destroy', 'machineFlow/destroy');
    });

    //设备电子证书
    Route::group('permission/', function () {
        Route::get('check', 'permission/check'); //检查权限
        Route::post('apply', 'permission/apply'); //提交申请
    });

    //高危工作许可证
    Route::group('risk/', function () {
        Route::get('getList', 'risk/getList'); //列表
        Route::get('getCertificateList', 'risk/getCertificateList'); //可申请证书列表
        Route::get('getData', 'risk/getData'); //申请详情
        Route::get('getLogOffData', 'risk/getLogOffData'); //注销详情
        Route::post('logOff', 'risk/logOff'); //申请
        Route::post('apply', 'risk/apply'); //申请
        Route::get('getTypeList', 'risk/getTypeList'); //类型列表
        Route::get('getTypeDetail', 'risk/getTypeDetail'); //类型详情
        Route::get('getApplyList', 'risk/getApplyList'); //申请列表
        Route::get('getDetail', 'risk/getDetail'); //详情
        Route::post('audit', 'risk/audit'); //审核申请记录

    });

    //培训签到
    Route::group('train/', function () {
        Route::get('getList', 'train/getList'); //培训记录
        Route::get('getData', 'train/getData'); //获取数据
        Route::post('checkIn', 'train/checkIn'); //签到
    });

    //检查表
    Route::group('checkList/', function () {
        Route::post('create', 'checkList/create'); //新增检查表
        Route::get('getTypeList', 'checkList/getTypeList'); //类型列表
        Route::get('getList', 'checkList/getList'); //检查表列表
        Route::get('getDetail', 'checkList/getDetail'); //详情
        Route::post('checkRecordSubmit', 'checkList/checkRecordSubmit'); //检查记录提交
        Route::get('getOptions', 'checkList/getOptions'); //获取字典
    });

    //区域
    Route::group('area/', function () {
        Route::get('getListbytypeuuid', 'area/getListByTypeUuid'); //列表
    });

    //数字追踪
    Route::group('digitalMachine/', function () {
        Route::group('', function () {
            Route::get('getList', 'digitalMachine/getList'); //列表
            Route::get('getData', 'digitalMachine/getDetail'); //获取设备详情
            Route::get('checkApplyAuth', 'digitalMachine/checkUserCanApply'); //设备申请入口判断
            Route::get('getDigitalMachineRiskData', 'digitalMachine/getDigitalMachineRiskData'); //设备的最近许可证
            Route::get('getDigitalMachineHeavyData', 'digitalMachine/getDigitalMachineHeavyData'); //设备的最近检查数据
            Route::get('getDigitalMachineRepairData', 'digitalMachine/getDigitalMachineRepairData'); //设备的最近检修数据
            Route::get('driverGetMachines', 'digitalMachine/accordWorkerUuidGetDigitalMachine'); //根据驾驶员获取绑定设备
            Route::get('getRepairFlowFormList', 'digitalMachine/accordFlowUuidGetFlowFormList'); //根据流程UUID获取检修流程下的表单列表
            Route::get('getRepairList', 'digitalMachine/getDigitalMachineBindDigitalMachineRepairList'); //根据设备UUID获取检修列表
            Route::get('getRepairData', 'digitalMachine/getDigitalMachineRepairRecordData'); //根据检修UUID获取检修详情
            Route::get('getFileList', 'digitalMachine/getDigitalMachineFileList'); //设备获取文件列表
            Route::get('getFileData', 'digitalMachine/getFileData'); //获取附件详情
        });

        Route::get('getType', 'digitalMachine/getType'); //获取设备分类
    });

    //检修记录
    Route::group('repair/', function () {
        Route::get('getRepairFlowFormList', 'repair/accordFlowUuidGetFlowFormList'); //根据流程UUID获取检修流程下的表单列表
        Route::post('apply', 'repair/apply'); //申请
        Route::post('audit', 'repair/audit'); //审核
        Route::get('getNextForm', 'repair/getNextForm'); //获取下一个可填写表单
    });

    //设备许可证
    Route::group('MachineRisk/', function () {
        Route::group('', function () {
            Route::get('getList', 'MachineRisk/getList'); //许可证申请列表
            Route::post('apply', 'MachineRisk/apply'); //设备许可证申请
            Route::get('getDetail', 'MachineRisk/getDetail'); //详情
            Route::post('audit', 'MachineRisk/audit'); //审核
            Route::get('getNextForm', 'MachineRisk/getNextForm'); //获取下一个可填写表单
            Route::get('getMachineDetail', 'MachineRisk/getMachineDetail'); //设备详情
        });

        Route::get('getOptions', 'MachineRisk/getOptions'); //获取字典
        Route::get('getRecordDetail', 'MachineRisk/getRecordDetail'); //获取表单提交详情

    });
    //设备许可证
    Route::group('Repair/', function () {
        Route::group('', function () {
            Route::get('getList', 'Repair/getList'); //检修申请列表
            Route::post('apply', 'Repair/apply'); //检修申请
            Route::get('getDetail', 'Repair/getDetail'); //详情
            Route::post('audit', 'Repair/audit'); //审核
            Route::get('getNextForm', 'Repair/getNextForm'); //获取下一个可填写表单
            Route::get('getMachineDetail', 'Repair/getMachineDetail'); //设备详情
        });

        Route::get('getOptions', 'MachineRisk/getOptions'); //获取字典
        Route::get('getRecordDetail', 'MachineRisk/getRecordDetail'); //获取表单提交详情

    });
    //设备许可证附表
    Route::group('MachineRiskSubForm/', function () {
        Route::group('', function () {
            Route::get('getList', 'MachineRiskSubForm/getList'); //许可证申请列表
            Route::get('getDetail', 'MachineRiskSubForm/getDetail'); //详情
            Route::post('apply', 'MachineRiskSubForm/apply'); //设备许可证申请
            Route::post('audit', 'MachineRiskSubForm/audit'); //审核
            Route::get('getNextForm', 'MachineRiskSubForm/getNextForm'); //获取下一个可填写表单
            Route::get('getSubFormTypeList', 'MachineRiskSubForm/getSubFormTypeList'); //获取附表列表
            Route::get('getSubFormTypeDetail', 'MachineRiskSubForm/getSubFormTypeDetail'); //获取附表详情
        });
        Route::get('getOptions', 'MachineRiskSubForm/getOptions'); //获取字典
    });

})->prefix('user.v1.')->middleware(['checkLogin', 'getAuthWhere', 'checkData', 'dataEncryption']);


